Useful example of a shutdown hook in Java